def caesar_cipher(input_str, key=3):  # 示例秘钥为3，您可以自由设定
    encrypted_str = ""
    for char in input_str:
        if char.isalpha():
            shift = key % 26
            if char.islower():
                new_char = chr(((ord(char) - ord('a') + shift) % 26) + ord('a'))
            else:
                new_char = chr(((ord(char) - ord('A') + shift) % 26) + ord('A'))
            encrypted_str += new_char
        else:
            encrypted_str += char
    return encrypted_str
